import Vue from 'vue';
import store from './store';
import indexRouter from './router';
import App from './App.vue';
import axios from 'axios';
import BaiduMap from 'vue-baidu-map';
require('./mock');
import './plugin/vant';
import 'vant/lib/index.css';
import './assets/css/global.css';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css'

Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'FRRv2IkvGwEmKFH83Y1GAUubeO2KXK3Y'
});

axios.defaults.baseURL = "http://www.liulongbin.top:3005/";
Vue.config.productionTip = false;
axios.interceptors.request.use(config => {
  NProgress.start();
  config.headers.Authorization = window.sessionStorage.getItem('token');
  return config;
});
axios.interceptors.response.use(config => {
  NProgress.done();
  return config;
});

Vue.prototype.$http = axios;

Vue.filter('clipDate', (date, start, length) => {
  return date.substring(start, length);
});

new Vue({
  router: indexRouter,
  store,
  render: h => h(App)
}).$mount('#app')
